#!/bin/sh
#
# ID: $Id: install.sh 15 2006-02-21 01:48:20Z yijun $
# Author: Yijun Yu
# Date: Feb 20, 2006
#
#### commands
SVN=$HOME/software/svn 
MAKE=/usr/bin/gmake
MKDIR=/bin/mkdir
WGET=/usr/bin/wget
TAR=tar
MV=mv
CD=cd
CP=cp

#### repository paths
VER=3.4.5
REPO=/cs/htdocs/km/precj/repo/trunk
HOST=www.cs.toronto.edu
PROTOCOL=svn
URL=$PROTOCOL://$HOST/$REPO

#### installation paths
SRC=$HOME/IDE/gcc
TARGET=$HOME/software
WORKDIR=$HOME/Workspaces/precj
WORKCOPY=$WORKDIR
export CLASSPATH=$TARGET/share/java/libgcj-$VER.jar

#### download
$MKDIR -p $SRC
cd $SRC
$WGET ftp://ftp.mirrorservice.org/sites/sources.redhat.com/pub/gcc/releases/gcc-$VER/gcc-$VER.tar.bz2
$TAR xfj gcc-$VER.tar.bz2
$MV gcc-$VER $VER

#### prepare repository
$SVN co $URL $WORKCOPY
$CD $WORKCOPY
$CP gcc/java/*.c $SRC/$VER/gcc/java

#### compilation
$MKDIR -p build/$VER
$CD build/$VER
$SRC/configure --prefix=$TARGET --enable-languages=java
$MAKE
$MAKE install

# testing
$CD $WORKCOPY
$TARGET/bin/gcj --main=t t.java
./a.out
